<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/4/8
 * Time: 13:44
 */

namespace app\api\controller;


use app\common\service\BannersService;
use app\common\service\GoodsService;
use app\common\service\OthersService;
use app\common\service\TypeService;
use think\Db;

class Index
{

    /*
     * 轮播图列表
     */
    public function banners(){
        $position = input('position');
        $bService = new BannersService();
        $list = ($bService->dbList(0,$position,1))->select();
        return apiSuccess($list);
    }

    /**
     *搜索关键词
     */
    public function searchKey(){
        $oService = new OthersService();
        $result = $oService->getOthersValue('searchkey');
        return apiSuccess($result);
    }


    /**
     * 首页消息
     */
    public function message(){
        $oService = new OthersService();
        $result = $oService->getOthersValue('message');
        return apiSuccess(@$result[0]);
    }

    /**
     * 优选商品
     */
    public function goodsTop(){
        $gService = new GoodsService(input());
        $result = $gService->dataListTop();
        return apiSuccess($result);
    }

    public function typesTop(){
        $gService = new TypeService(input());
        $result = $gService->datalistTop();
        return apiSuccess($result);
    }

}